import axios from '@/libs/api.request'
// 查询方法集
export const queryMethodJarApi = () => axios.request({
  url: 'ids/method/jar/all',
  method: 'get'
})

// 查询方法集下的方法
export const queryMethodApi = params => axios.request({
  url: `ids/method/jar/${params.jarId}/content`,
  method: 'get'
})

// 获得方法集基本信息分页列表
export const queryMethodJarPageApi = params => axios.request({
  url: 'ids/method/jar',
  method: 'get',
  params
})

// 新建方法基本信息
export const postMethodJarApi = data => axios.request({
  url: 'ids/method/jar',
  method: 'post',
  data
})

// 获得方法集基本信息
export const getMethodJarInfoApi = params => axios.request({
  url: `ids/method/jar${params.jarId}`,
  method: 'get'
})

// 更新方法集基本信息
export const putMethodJarInfoApi = (path, data) => axios.request({
  url: `ids/method/jar${path.jarId}`,
  method: 'put',
  data
})

// 删除方法集基本信息
export const deleteMethodJarInfoApi = path => axios.request({
  url: `ids/method/jar${path.jarId}`,
  method: 'delete'
})

// 获得方法集下的方法定义
export const getMethodJarContentApi = path => axios.request({
  url: `ids/method/jar${path.jarId}/content`,
  method: 'get'
})

// 提交方法集内容
export const postMethodJarContentApi = (path, data) => axios.request({
  url: `ids/method/jar${path.jarId}/content`,
  method: 'get',
  data
})

// maven拉取jar文件解析
export const getMethodJarContentByMavenApi = (path, params) => axios.request({
  url: `/ids/method/jar/${path.jarId}/syncFile`,
  method: 'get',
  params
})

// 上传jar文件解析
const headers = { 'Content-Type': 'multipart/form-data' }
export const getMethodJarContentByFileApi = (path, data) => axios.request({
  url: `/ids/method/jar/${path.jarId}/uploadFile`,
  method: 'post',
  data,
  headers
})
